#ifndef NEWSPARSER_H
#define NEWSPARSER_H

#include <QApplication>
#include <QTcpSocket>
#include <QObject>
#include <QUrl>
#include <QString>
#include <QMap>
#include <QDebug>
#include <QThread>
#include <QStringList>
#include <QDomDocument>
#include <QDomNode>
#include <QDomNodeList>

#include "FeedRSS.h"

class NewsParser : public QThread
{
	
	Q_OBJECT
		
private:
	QMap<QString, QUrl> *rssUrls;
	QUrl currentUrl;	//this is the url will be parsed
	
	void parseFeedRss(QUrl &rss);
	QString fetchHttpPage(QUrl &rss);

signals:
	void newsReady(FeedRSS *news);
	void newsError(QString error);	

public:
	void run();
	NewsParser();
	QMap<QString, QUrl> *getRssUrls();
	void setCurrentUrlAndStart(QString rssKey);		//call this to start!
};
#endif
